@echo off
setlocal EnableDelayedExpansion
set "code=A B C D E F G H I J K L N M O P Q R S T U V W X Y Z" 

echo,>osf.h
echo #ifndef __OSF_H__>>osf.h
echo #define __OSF_H__>>osf.h
echo static char osf[][64]={>>osf.h
echo,>>osf.h

set /a count=0
set /a sprcount=0
set /a externsprcount=0
set /a bgmcount=0
set /a wavcount=0




echo,>>osf.h
echo #define IDP_SPR_SPX %count% >>osf.h
for /f "delims=" %%i in ('dir /b "spr"') do (
set var=%%i
set var=!var:~0,-4!
echo "..\\res\\spr\\%%i",>>osf.h
echo %%i
for %%j in (%code%) do call,set "var=%%var:%%j=%%j%%"  
echo #define IDD_!var!_BMX !count! >>osf.h
set /a count+=1
set /a sprcount+=1
)

echo #define IDP_BK_SPX %count% >>osf.h
for /f "delims=" %%i in ('dir /b "bk"') do (
set var=%%i
set var=!var:~0,-4!
echo "..\\res\\bk\\%%i",>>osf.h
echo %%i
for %%j in (%code%) do call,set "var=%%var:%%j=%%j%%" 
echo #define IDD_!var!_JPG !count! >>osf.h
set /a count+=1

)

echo,>>osf.h
echo #define IDP_EXTERNSPR_SPX %count% >>osf.h
for /f "delims=" %%i in ('dir /b "externspr"') do (
set var=%%i
set var=!var:~0,-4!
echo "..\\res\\externspr\\%%i",>>osf.h
echo %%i
for %%j in (%code%) do call,set "var=%%var:%%j=%%j%%" 
echo #define IDD_!var!_BMX !count! >>osf.h
set /a count+=1
set /a externspr+=1
)

echo,>>osf.h
echo #define IDP_WAV_SPX %count% >>osf.h
for /f "delims=" %%i in ('dir /b "wav"') do (
set var=%%i
set var=!var:~0,-4!
echo "..\\res\\wav\\%%i",>>osf.h
echo %%i
for %%j in (%code%) do call,set "var=%%var:%%j=%%j%%" 
echo #define IDD_!var!_WAV !count! >>osf.h
set /a count+=1
set /a wavcount+=1
)

echo,>>osf.h
echo #define IDP_BGM_SPX %count% >>osf.h
for /f "delims=" %%i in ('dir /b "bgm"') do (
set var=%%i
set var=!var:~0,-4!
echo "..\\res\\bgm\\%%i",>>osf.h
echo %%i
for %%j in (%code%) do call,set "var=%%var:%%j=%%j%%" 
echo #define IDN_!var!_XAV !count! >>osf.h
set /a count+=1
set /a bgmcount+=1
)


echo,>>osf.h

for /f "delims=" %%i in ('dir /b "pal"') do (
rem pause
set var=%%i
set var=!var:~0,-4!
echo "..\\res\\pal\\%%i",>>osf.h
echo %%i
for %%j in (%code%) do call,set "var=%%var:%%j=%%j%%" 
echo #define IDN_!var!_PAL !count! >>osf.h
set /a count+=1
rem pause
)
echo,>>osf.h
echo };>>osf.h
echo,>>osf.h
echo #define IDD_SPR_SOURCE_COUNT %sprcount% >>osf.h
echo #define IDD_EXTERNSPR_SOURCE_COUNT %externsprcount% >>osf.h
echo #define IDD_WAV_SOURCE_COUNT %wavcount% >>osf.h
echo #define IDD_BGM_SOURCE_COUNT %bgmcount% >>osf.h
echo #endif>>osf.h

::pause











